//
//  TestViewController.swift
//  Weibo-Swift
//
//  Created by law on 2018/6/1.
//  Copyright © 2018年 JKing. All rights reserved.
//

import UIKit

class TestViewController: UIViewController {

    override func viewDidLoad() {
        title = "第\(navigationController?.viewControllers.count ?? 0)个"
        setupCollection()
    }
    
    @objc private func pushNext() {
        let vc = TestViewController()
        navigationController?.pushViewController(vc, animated: true)
    }
    
}

extension TestViewController {
    
    func setupCollection() {
    
        let collectionView = UICollectionView(frame: CGRect(x: 0, y: 0, width: view.frame.width, height: view.frame.height), collectionViewLayout: UICollectionViewLayout())
        collectionView.backgroundColor = UIColor.blue
        collectionView.contentInset = UIEdgeInsetsMake(200, 0, 0, 0)
        
        let header = UIView(frame: CGRect(x: 0, y: -200, width: view.frame.width, height: 200))
        header.backgroundColor = UIColor.red
        
        collectionView.addSubview(header)
        view.addSubview(collectionView)
    }
    
//    override func setupTableView() {
//        super.setupTableView()
//
//        navigationItem.rightBarButtonItem = UIBarButtonItem(title: "下一个", target: self, action: #selector(pushNext))
//    }
    
}
